package cn.wolfcode.shop.task;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Reference;

import cn.wolfcode.shop.service.ICatalogService;

@Component
public class PropertyCountRefreshTask implements ApplicationListener<ContextRefreshedEvent> {

	@Reference
	private ICatalogService catalogService;

	@Override
	public void onApplicationEvent(ContextRefreshedEvent event) {
		//		catalogService.listChildCataologPerMinute();
		catalogService.listCataologPropertyCountOneHour();
	}

	//	@Scheduled(cron = "0 0/1 * * * ?") 每分钟
	public void listChildCataologPerMinute() {
		catalogService.listChildCataologPerMinute();
	}

	//	@Scheduled(cron = "0 0 0/1 * * ?") 每小时
	@Scheduled(cron = "0 0 0 1/1 * ?") // 每天
	public void listCataologPropertyCountOneHour() {
		catalogService.listCataologPropertyCountOneHour();
	}

}
